﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using ZRegex;

public class Exmaple_Email : MonoBehaviour
{
    public InputField m_InputField;
    public Text m_TextResults;
    public Text m_TextResultsCode;

    // Start is called before the first frame update
    void Start()
    {
        if (null != m_InputField)
        {
            m_InputField.onValueChanged.AddListener(OnInputValueChanged);
        }
    }

    public void OnInputValueChanged( string value )
    {
        if( null != m_TextResults)
        {
            bool results = RegexUtility.IsName(value);
            m_TextResults.text = results ? "TRUE" : "FLASE";
            m_TextResults.color = results ? Color.green : Color.red;
        }

        if (null != m_TextResultsCode)
        {
            m_TextResultsCode.text = ""+RegexUtility.IsNameCode(value); 
        }
    }

}
